Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadPageViewCollection=function(a){this._owner=a;
this._data=[];
};
Telerik.Web.UI.RadPageViewCollection.prototype={get_count:function(){return this._data.length;
},_add:function(a){this._insert(this.get_count(),a);
},_insert:function(b,a){Array.insert(this._data,b,a);
a._multiPage=this._owner;
},insert:function(b,a){this._insert(b,a);
this._owner._onPageViewInserted(b,a);
},add:function(a){this.insert(this.get_count(),a);
},getPageView:function(a){return this._data[a]||null;
},removeAt:function(b){var a=this.getPageView(b);
if(a){this.remove(a);
}},remove:function(a){this._owner._onPageViewRemoving(a);
a.unselect();
Array.remove(this._data,a);
this._owner._onPageViewRemoved(a);
}};
Telerik.Web.UI.RadPageViewCollection.registerClass("Telerik.Web.UI.RadPageViewCollection");
Telerik.Web.UI.RadPageView=function(a){this._element=a;
};
Telerik.Web.UI.RadPageView.prototype={_select:function(a){var b=this.get_multiPage();
if(!b){this._cachedSelected=true;
return;
}b._selectPageViewByIndex(this.get_index(),a);
},hide:function(){var a=this.get_element();
if(!a){return;
}Sys.UI.DomElement.addCssClass(a,"rmpHiddenView");
a.style.display="none";
},show:function(){var a=this.get_element();
if(!a){return;
}Sys.UI.DomElement.removeCssClass(a,"rmpHiddenView");
a.style.display="block";
if(this._repaintCalled){return;
}$telerik.repaintChildren(this);
this._repaintCalled=true;
},get_element:function(){return this._element;
},get_index:function(){return Array.indexOf(this.get_multiPage().get_pageViews()._data,this);
},get_id:function(){return this._id;
},set_id:function(a){this._id=a;
if(this.get_element()){this.get_element().id=a;
}},get_multiPage:function(){return this._multiPage||null;
},get_selected:function(){return this.get_multiPage().get_selectedPageView()==this;
},set_selected:function(a){if(a){this.select();
}else{this.unselect();
}},select:function(){this._select();
},unselect:function(){if(this.get_selected()){this.get_multiPage().set_selectedIndex(-1);
}}};
Telerik.Web.UI.RadPageView.registerClass("Telerik.Web.UI.RadPageView");
Telerik.Web.UI.RadMultiPage=function(a){Telerik.Web.UI.RadMultiPage.initializeBase(this,[a]);
this._pageViews=new Telerik.Web.UI.RadPageViewCollection(this);
this._selectedIndex=-1;
this._pageViewData=null;
this._changeLog=[];
};
Telerik.Web.UI.RadMultiPage.prototype={_logInsert:function(a){if(!this._trackingChanges){return;
}Array.add(this._changeLog,{type:1,index:a.get_index()});
},_logRemove:function(a){if(!this._trackingChanges){return;
}Array.add(this._changeLog,{type:2,index:a.get_index()});
},_onPageViewRemoving:function(a){this._logRemove(a);
},_onPageViewInserted:function(e,d){var c=d.get_element();
if(!c){c=d._element=document.createElement("div");
}c.style.display="none";
if(d.get_id()){c.id=d.get_id();
}var a=this.get_pageViews().getPageView(e+1);
var b=$get(this.get_clientStateFieldID());
if(a){b=a.get_element();
}this.get_element().insertBefore(c,b);
if(d._cachedSelected){d._cachedSelected=false;
d.select();
}this._logInsert(d);
},_onPageViewRemoved:function(a){if(a.get_element()){this.get_element().removeChild(a.get_element());
}},_selectPageViewByIndex:function(d,a){if(this._selectedIndex==d){return;
}if(!this.get_isInitialized()){this._selectedIndex=d;
return;
}if(d<-1||d>=this.get_pageViews().get_count()){return;
}var b=this.get_selectedPageView();
this._selectedIndex=d;
var c=this.get_selectedPageView();
if(!a){if(b){b.hide();
}if(c){c.show();
}}this.updateClientState();
},trackChanges:function(){this._trackingChanges=true;
},commitChanges:function(){this.updateClientState();
this._trackingChanges=false;
},get_pageViewData:function(){return this._pageViewData;
},set_pageViewData:function(a){this._pageViewData=a;
},initialize:function(){Telerik.Web.UI.RadMultiPage.callBaseMethod(this,"initialize");
var a=this.get_pageViewData();
for(var b=0;
b<a.length;
b++){var c=new Telerik.Web.UI.RadPageView($get(a[b].id));
c._id=a[b].id;
this._pageViews._add(c);
}},findPageViewByID:function(c){for(var b=0;
b<this.get_pageViews().get_count();
b++){var a=this.get_pageViews().getPageView(b);
if(a.get_id()==c){return a;
}}return null;
},get_pageViews:function(){return this._pageViews;
},get_selectedIndex:function(){return this._selectedIndex;
},set_selectedIndex:function(a){this._selectPageViewByIndex(a);
},get_selectedPageView:function(){return this.get_pageViews().getPageView(this.get_selectedIndex());
},saveClientState:function(){var a={};
a.selectedIndex=this.get_selectedIndex();
a.changeLog=this._changeLog;
return Sys.Serialization.JavaScriptSerializer.serialize(a);
}};
Telerik.Web.UI.RadMultiPage.registerClass("Telerik.Web.UI.RadMultiPage",Telerik.Web.UI.RadWebControl);
